;;; GNU Guix --- Functional package management for GNU
;;;
;;; Copyright © 2021 muradm <mail@muradm.net>
;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
;;; Copyright © 2022 (unmatched parenthesis <paren@disroot.org>
;;;
;;; This file is not part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (guixrus packages greetd)
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu packages kde-frameworks)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages qt)
  #:use-module (gnu packages web)
  #:use-module (guix build-system cmake)
  #:use-module (guix gexp)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages))

(define-public qtgreet
  (let ((commit "7945562abebfd3e4ad526dadf05fdf3c1752d943")
        (revision "0"))
    (package
     (name "qtgreet")
     (version (git-version "1.0.0" revision commit))
     (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://gitlab.com/marcusbritanicus/QtGreet")
                    (commit commit)))
              (modules '((guix build utils)))
              (snippet
               #~(delete-file-recursively "3rdparty"))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "054my7cp4amlrfrdsfwwri1519nbzafnwy3b4a4697van3rkyi6c"))))
     (build-system cmake-build-system)
     (arguments
      (list #:tests? #f ;no tests
            #:phases
            #~(modify-phases %standard-phases
                (add-after 'unpack 'patch-cmake-lists
                  (lambda _
                    (substitute* "src/CMakeLists.txt"
                      (("/etc/qtgreet") "share/qtgreet"))))
                (add-before 'configure 'change-directory
                  (lambda _
                    (chdir "src"))))))
     (inputs (list json-c qtbase-5 qtwayland-5))
     (native-inputs
      (list extra-cmake-modules
            pkg-config
            wayland))
     (synopsis "Qt-based, featureful greeter for greetd")
     (description
      "This is a Qt-based greeter using a wlroots based compositor
(cage, sway, wayfire) to display a login interface that's defined
via QML.")
     (home-page "https://gitlab.com/marcusbritanicus/QtGreet")
     (license license:expat))))
